<script setup>
import { useRouter } from "vue-router";
import { ref, onBeforeMount } from "vue";
const router = useRouter();
let usename = ref();
onBeforeMount(() => {
  const data = localStorage.getItem("user");
  console.log(data);
  usename.value = JSON.parse(data).username;
});
let currentName = ref(router.currentRoute.value.fullPath.split("/")[1]);
const handledenglu = () => {
  router.push("/denglu");
};

const handleLogout = () => {
  usename.value = null;
  localStorage.removeItem("user");
};
const list1 = ref([
  {
    name1: "首页",
    active1: true,
  },
  {
    name1: "课程",
    active1: false,
  },
  {
    name1: "认证教练",
    active1: false,
  },
  {
    name1: "我的运动",
    active1: false,
  },
  {
    name1: "关于",
    active1: false,
  },
]);

const active1 = (item) => {
  list1.value.forEach = (i) => {
    i.value = false;
  };
  item.active1 = true;
};
</script>

<template>
  <header class="navigation">
    <div class="container">
      <div class="logo">
        <img src="/img/tubiao.png" alt="" />
      </div>
      <ul class="nav">
        <li class="">
          <a
            target="_self"
            href="#"
            :class="currentName == 'home' ? 'active1' : ''"
            >首页</a
          >
        </li>
        <li class="">
          <div
            class="tess"
            href="./kecheng.html"
            @click="$router.push('/kecheng')"
          >
            课程
          </div>
        </li>
        <li class="">
          <div
            class="tess"
            href="./jiaolian.vue"
            @click="$router.push('/jiaolian')"
          >
            认证教练
          </div>
        </li>
        <li class="">
          <div
            class="tess"
            href="./yundong.vue"
            @click="$router.push('/yundong')"
          >
            我的运动
          </div>
        </li>
        <li class="">
          <div
            class="tess"
            href="./guanyu.vue"
            @click="$router.push('/guanyu')"
          >
            关于
          </div>
        </li>
        <div class="form">
          <input type="text" placeholder="课程" />
          <div class="sousuo">
            <img src="/img/sousuo.png" alt="" />
          </div>
        </div>
      </ul>
    </div>
    <div class="individual1">
      <span class="tess" @click="handleLogout" v-if="usename != null"
        >退出登录</span
      >
    </div>
    <div class="individual" style="display: flex" v-if="usename == null">
      <div class="tess" href="" @click="handledenglu">登录 /</div>
      <div class="tess" href="" @click="$router.push('/zhuce')">注册</div>
    </div>
    <div class="individual1" style="display: flex" v-if="usename != null">
      <div
        style="
           {
            display: flex;
            width: 100%;
          }
        "
        href=""
        class="tess"
      >
        <span>欢迎你！</span>
        <span>{{ usename }}</span>
      </div>
    </div>
    <div
      class="personal-page"
      href=".gerenzhuye.vue"
      @click="$router.push('/gerenzhuye')"
    >
      <img src="/img/personaal.png" alt="" />
    </div>
  </header>

  <el-backtop :right="80" :bottom="80" />

  <el-carousel height="850px" width="100%">
    <el-carousel-item>
      <img src="/img/lunbo01.png" alt="" style="width: 100%" />
    </el-carousel-item>
    <el-carousel-item>
      <img src="/img/lunbo02.png" alt="" style="width: 100%" />
    </el-carousel-item>
    <el-carousel-item>
      <img src="/img/lunbo03.png" alt="" style="width: 100%" />
    </el-carousel-item>
    <el-carousel-item>
      <img src="/img/lunbo04.png" alt="" style="width: 100%" />
    </el-carousel-item>
  </el-carousel>

  <div class="zhuti01">
    <ul class="zhuti02">
      <li
        class=""
        style="
          background-image: url(./img/quanbu.png);
          background-repeat: no-repeat;
          background-size: cover;
          background-position: center;
        "
      >
        <div class="zi1" href="./kecheng.vue" @click="$router.push('/kecheng')">
          <h1 style="margin: 0 auto; padding-top: 20px">01 全部课程</h1>
          <p style="margin: 0 auto; padding-top: 100px; width: 200px">
            包含健身课程、高强度训练课程、户外运动、有氧运动等
          </p>
        </div>
      </li>
      <li
        class=""
        style="
          background-image: url(./img/ranzhi.png);
          background-repeat: no-repeat;
          background-size: cover;
          background-position: center;
        "
      >
        <div class="zi1" href="./kecheng.vue" @click="$router.push('/kecheng')">
          <h1 style="margin: 0 auto; padding-top: 20px">02 健身课程</h1>
          <p style="margin: 0 auto; padding-top: 100px; width: 200px">
            将前沿科学、激励方式和能量训练融合在一起，让你爱上力刻
          </p>
        </div>
      </li>
      <li
        class=""
        style="
          background-image: url(./img/xingti.png);
          background-repeat: no-repeat;
          background-size: cover;
          background-position: center;
        "
      >
        <div class="zi1" href="./kecheng.vue" @click="$router.push('/kecheng')">
          <h1 style="margin: 0 auto; padding-top: 20px">03 高强度训练课程</h1>
          <p style="margin: 0 auto; padding-top: 100px; width: 200px">
            是一种科学设计的高强度间歇训练，让你保持心血管健康，提高力量，同时最大程度地燃烧卡路里，激发出你的潜能
          </p>
        </div>
      </li>
      <li
        class=""
        style="
          background-image: url(./img/huwai.png);
          background-repeat: no-repeat;
          background-size: cover;
          background-position: center;
        "
      >
        <div class="zi1" href="./kecheng.vue" @click="$router.push('/kecheng')">
          <h1 style="margin: 0 auto; padding-top: 20px">04 户外课程</h1>
          <p style="margin: 0 auto; padding-top: 100px; width: 200px">
            去呼吸一下新鲜空气吧
          </p>
        </div>
      </li>
    </ul>
  </div>
  <div class="zhuti03">
    <div class="zhuti04">官方合作伙伴</div>
    <div class="zhuti05">
      <div class="hezuo"><img src="/img/nike.png" alt="" /></div>
      <div class="hezuo"><img src="/img/adidas.png" alt="" /></div>
      <div class="hezuo"><img src="/img/andema.png" alt="" /></div>
      <div class="hezuo"><img src="/img/biaoma.png" alt="" /></div>
      <div class="hezuo"><img src="/img/yaseshi.png" alt="" /></div>
      <div class="hezuo"><img src="/img/meijinnong.png" alt="" /></div>
    </div>
  </div>

  <div class="zhuti06">
    <div class="shangcheng">
      <h2>力刻商城</h2>
      <h5 style="cursor: pointer">更多商品 ></h5>
    </div>
    <div class="shangpin">
      <div class="shangpin1">
        <img src="/img/gangling.png" />
        <p style="font-size: 20px">杠铃组</p>
        <p style="color: red">￥324起</p>
        <button>
          <a
            href="https://detail.tmall.com/item.htm?abbucket=19&id=41306836161&ns=1&spm=a21n57.1.0.0.1e20523c3E57G2&sku_properties=3344920:26282041819"
            >立即购买</a
          >
        </button>
      </div>
      <div class="shangpin1">
        <img src="/img/yaling.png" alt="" />
        <p style="font-size: 20px">哑铃组</p>
        <p style="color: red">￥324起</p>
        <button>
          <a
            href="https://detail.tmall.com/item.htm?abbucket=19&id=41306836161&ns=1&spm=a21n57.1.0.0.1e20523c3E57G2&sku_properties=3344920:26282041819"
            >立即购买</a
          >
        </button>
      </div>
      <div class="shangpin1">
        <img src="/img/tanlishen.png" alt="" />
        <p style="font-size: 20px">弹力绳</p>
        <p style="color: red">￥199起</p>
        <button>
          <a
            href="https://item.taobao.com/item.htm?spm=a21n57.1.0.0.1e20523c3E57G2&id=739953297263&ns=1&abbucket=19#detail"
            >立即购买</a
          >
        </button>
      </div>
    </div>
  </div>

  <footer>
    <div class="w help">
      <div class="liikee">
        <img src="/img/tubiaoblack.png" alt="" />
        <p>力量的接收者，力量的传递者</p>
      </div>
      <div class="fl">
        <dl>
          <dt>关于力刻</dt>
          <dd><a href="#">关于力刻</a></dd>
          <dd><a href="#">资料下载</a></dd>
          <dd><a href="#">查找课程</a></dd>
          <dd><a href="#">俱乐部</a></dd>
          <dd><a href="#">教练员+</a></dd>
          <dd><a href="#">联系我们</a></dd>
          <dd><a href="#">侵权投诉</a></dd>
          <dd><a href="#">隐私条款</a></dd>
        </dl>
      </div>
      <div class="fl2">
        <dl>
          <dt>产品与服务</dt>
          <dd><a href="#">APP</a></dd>
          <dd><a href="#">消费品</a></dd>
          <dd><a href="#">智能装备</a></dd>
        </dl>
      </div>
      <div class="fl2">
        <dl>
          <dt>其他</dt>
          <dd><a href="#">力刻公益</a></dd>
          <dd><a href="#">媒体</a></dd>
        </dl>
      </div>
      <div class="fl2">
        <dl>
          <dt>规范说明</dt>
          <dd><a href="#">社区规范</a></dd>
          <dd><a href="#">用户公约</a></dd>
          <dd><a href="#">规则百科</a></dd>
          <dd><a href="#">侵权投诉说明</a></dd>
        </dl>
      </div>

      <div class="fr coverage">
        <h5>力刻线下体验店</h5>
        <p>已经在全国开设多家线下体验店</p>
        <a href="#" style="color: black">查看详情 > </a>
      </div>
    </div>
  </footer>
</template>

<style scoped>
.active1 {
  border: 3px solid #8e6dd7;
}

a {
  text-decoration: none;
  color: white;
}
.tess {
  text-decoration: none;
  color: white;
  cursor: pointer;
}
.navigation {
  width: 100%;
  height: 100px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  background-color: black;
  margin: 0;
  padding: 0;
}
.container {
  width: 1000px;
  height: 100px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0;
}
.logo {
  width: 165px;
  height: 100px;
  background-color: rgb(85, 9, 156);
}
.logo img {
  width: 165px;
  height: 22px;
  padding: 38px 0;
}
.nav {
  list-style: none;
  width: 800px;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav li {
  width: 100px;
  font-size: 20px;
  text-align: center;
}
.nav li:hover {
  font-weight: bold;
}
.nav li:hover::after {
  content: "";
  width: 70%;
  height: 1px;
  display: block;
  margin: 0 auto;
  border-bottom: 4px solid #f81a05;
  padding: 1px;
}
.form {
  width: 250px;
  height: 35px;
  display: flex;
  padding-left: 10px;
}
.form input {
  width: 245px;
  height: 30px;
  float: left;
  font-size: 14px;
  padding-left: 3px;
}
.sousuo {
  width: 35px;
  height: 35px;
}
.sousuo img {
  width: 25px;
  height: 25px;
  padding: 5px 10px;
  cursor: pointer;
}
.individual {
  float: right;
  width: 90px;
  height: 35px;
  position: relative;
  top: -62px;
  left: -30px;
}
.individual1 {
  float: right;
  width: 90px;
  height: 35px;
  position: relative;
  top: -65px;
  left: -60px;
  font-size: 12px;
}
.personal-page {
  float: right;
  width: 40px;
  height: 40px;
  position: relative;
  top: -70px;
  left: 130px;
}
.personal-page img {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.el-backtop {
  color: rgb(155, 35, 235);
}

.el-carousel {
  margin-top: 100px;
}
.zhuti01 {
  width: 100%;
  margin-top: 150px;
}
.zhuti02 {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
}
.zhuti02 li {
  width: 25%;
  height: 600px;
}
.zi1 {
  color: rgba(240, 248, 255, 0);
  height: 600px;
  background-color: #f8190500;
  cursor: pointer;
}
.zi1:hover {
  color: white;
  text-align: center;
  background-color: rgba(42, 1, 99, 0.925);
}
.zhuti03 {
  width: 100%;
  height: 600px;
}
.zhuti04 {
  width: 100%;
  height: 50px;
  text-align: center;
  font-size: 30px;
  font-weight: bold;
  margin: 80px 0;
}
.zhuti05 {
  width: 1200px;
  margin-top: 100px;
  display: flex;
  flex-flow: wrap;
  margin: 0 auto;
}
.hezuo {
  width: 360px;
  height: 200px;
  margin: 20px 20px;
  box-shadow: 0px 0px 20px 0px rgba(193, 192, 192, 0.5);
}
.hezuo img {
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.zhuti06 {
  width: 100%;
  margin-top: 120px;
}
.shangcheng h2 {
  margin: 0 auto;
  width: 1200px;
  height: 100px;
  text-align: left;
  font-size: 40px;
  font-weight: bold;
  color: blueviolet;
}
.shangcheng h5 {
  text-align: right;
  font-size: 20px;
  margin-top: 0;
  margin-right: 200px;
}
.shangcheng h5:hover {
  color: blueviolet;
}
.shangpin {
  width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
.shangpin1 {
  width: 300px;
  height: 450px;
  text-align: center;
  box-shadow: 0px 0px 20px 0px rgba(193, 192, 192, 0.5);
}
.shangpin1 img {
  width: 300px;
  height: 250px;
}
.shangpin1 button {
  width: 100px;
  height: 50px;
  border: none;
  background-color: blueviolet;
  color: white;
  font-size: 15px;
  cursor: pointer;
}

.w {
  width: 1190px;
  margin: 0 auto;
  display: flex;
}
.liikee {
  margin-top: 60px;
  text-align: center;
}
.liikee img {
  width: 200px;
  height: 30px;
}

.fl {
  margin-top: 50px;
  margin-left: 100px;
}
.fl2 {
  margin-top: 50px;
  margin-left: 100px;
}
.fr {
  margin-top: 300px;
}
footer {
  margin-top: 90px;
  height: 500px;
  background-color: #eaeaea;
}
footer a {
  color: #666666;
}

.help dt {
  height: 30px;
  font-weight: bold;
  font-size: 23px;
  color: #666;
}
.help dd {
  font-size: 15px;
  height: 15px;
  margin-top: 20px;
  margin-left: 0;
}
.coverage {
  width: 200px;
  height: 150px;
  background: url(../img/ico_footer.png) no-repeat;
}
.coverage h5 {
  padding-left: 25px;
}
.coverage p {
  font-size: 12px;
  color: #666666;
  line-height: 18px;
  width: 180px;
}
.coverage a {
  display: block;
  margin-top: 5px;
  width: 180px;
  text-align: right;
}
</style>
